#ifndef MYXML_H
#define MYXML_H

#include <QObject>
#include <QMap>
#include <QDomDocument>
#include <QDateTime>

struct TestCase
{
    QString name;
    QString cmd;
    int counts;
    int timeMax;
    QString resultStart;
    QString resultEnd;
    int resultUpper;
    int resultLower;
    QString unitStr;
};

struct SetupCase
{
    QString devName;
    QString testFile;
    QDateTime startTime;
    QDateTime endTime;
    int         totalOutTimes;      // 测试总的超时时间，用于计算测试进度
    int         totalTestCounts;    // 总测试组次数，用于计算测试进度
};

class MyXML : public QObject
{
    Q_OBJECT
public:
    explicit MyXML(QObject *parent = nullptr);
    bool OpenXML(QString xmlName);
    QList<TestCase> GetDetail();
    SetupCase GetSetupDetail();
    bool SetSetupDetail(const SetupCase &setupcase);

signals:

public slots:

private:
    QString xmlName;
    QDomDocument doc;
    QDomElement root;
    bool findElement(QDomElement &srcElement, QDomElement &element,QString key);
};

#endif // MYXML_H
